package com.boot.unity.api.Constroller;


import com.alibaba.fastjson.JSONObject;
import com.boot.unity.api.common.Result;
import com.boot.unity.api.constants.NotifyType;
import com.boot.unity.api.entity.Student;
import com.boot.unity.api.utils.ConstantSmsUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.ObjectMapper;

@Api(tags = "通过前置机，推送计时数据")
@RestController
@RequestMapping("/syncSchedule")
@RequiredArgsConstructor
public class SyncScheduleContraoller {

    @PostMapping("/getStuInfo")
    public Result getStuInfo(@RequestBody String body){
//        JSONObject json = (JSONObject)JSONObject.parse(body);
        // 先将对象转换成实体类
        ObjectMapper objectMapper = new ObjectMapper();
        Student student = null;
        try {
            student = objectMapper.readValue(body,Student.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }


        return Result.success();
    }


}
